package com.wg.springboot;

import com.wg.springboot.config.School;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @Autowired
    private School school;

//    获取配置文件自定义值
    @Value("${school.name}")
    private String schoolName;

    @Value("${websit}")
    private String websit;

    @RequestMapping("/say")
    @ResponseBody
    public String say(){
//        return  schoolName+websit;
        return school.getName()+school.getWebsit();
    }
}
